home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 60 / 60.xpi / chrome / webdeveloper.jar / content / webdeveloper / common / history.js < prev    next >
Text File  |  2009-06-30  |  1KB  |  38 lines

  1. // Adds an href to the history
  2. function webdeveloper_addToHistory(href)
  3. {
  4.     // If the href is set
  5.     if(href)
  6.     {
  7.         var globalHistory = Components.classes["@mozilla.org/browser/global-history;1"].getService(Components.interfaces.nsIGlobalHistory);
  8.  
  9.         // If the href is not already in the history
  10.         if(!globalHistory.isVisited(href))
  11.         {
  12.             globalHistory.addPage(href);
  13.         }
  14.     }
  15. }
  16.  
  17. // Clears the history
  18. function webdeveloper_removeAllFromHistory()
  19. {
  20.     Components.classes["@mozilla.org/browser/global-history;2"].getService(Components.interfaces.nsIBrowserHistory).removeAllPages();
  21. }
  22.  
  23. // Removes an href from the history
  24. function webdeveloper_removeFromHistory(href)
  25. {
  26.     // If the href is set
  27.     if(href)
  28.     {
  29.         var globalHistory = Components.classes["@mozilla.org/browser/global-history;1"].getService(Components.interfaces.nsIGlobalHistory);
  30.  
  31.         // If the href is in the history
  32.         if(globalHistory.isVisited(href))
  33.         {
  34.             Components.classes["@mozilla.org/browser/global-history;2"].getService(Components.interfaces.nsIBrowserHistory).removePage(Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService).newURI(href, null, null));
  35.         }
  36.     }
  37. }
  38.